<template>
    <div v-if="news">
        <header-view></header-view>
        <div v-html="news.des" class="center"></div>
        <footer-view></footer-view>
    </div>

</template>
<script>
    import news from './../api/new';

    export default {
        name: 'news',
        data() {
            return {
                news: '',
                title: ''
            };
        },
        watch: {
            '$route': 'getNews'
            /*news(curVal, oldVal) {
                if (curVal) {
                    this.title = curVal.title;
                }
            },*/
        },
        mounted: function () {
            this.getNews();
        },
        methods: {
            getNews() {
                this.news = '';
                news.detail(this.$route.params.id).then(response => {
                    this.news = response.data;
                });
            }
        }
    };

</script>
<style>
    .center {
        padding: 15px;
        height: auto;
        background: rgb(255, 255, 255);
    }

    .center img {
        max-width: 100%;
        width: auto !important;
        height: auto !important;
    }
</style>
